package com.example.shop_2304.adapter

import android.graphics.Color
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.base.entity.CategoryEntityItem
import com.example.shop_2304.R

class OneCateAdapter:BaseQuickAdapter<CategoryEntityItem,BaseViewHolder>(R.layout.item_onecate) {
    var selectedType = 515
    override fun convert(holder: BaseViewHolder, item: CategoryEntityItem) {
        holder.setText(R.id.one_tv,item.name)
        if(item.id==selectedType){
            holder.setTextColor(R.id.one_tv,Color.RED)
        }else{
            holder.setTextColor(R.id.one_tv,Color.BLACK)
        }
    }

    fun setType(type:Int){
        selectedType = type
        notifyDataSetChanged()
    }
}